﻿using System;
using System.IO;
using System.Collections;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace FraudMitigator
{
    public static class Strings
    {
        public static Hashtable mainScreenColumnNames = new Hashtable();
        public static Hashtable editScreenColumnNames = new Hashtable();
        public static Hashtable editUsersColumnNames = new Hashtable();
        public static Hashtable printLettersColumnNames = new Hashtable();

        public static void InitMainScrnHashtable()
        {
            // add values to hashtable; digit represents column position and string represents header text
            mainScreenColumnNames[0] = "First Name";
            mainScreenColumnNames[1] = "Last Name";
            mainScreenColumnNames[2] = "St. Address";
            mainScreenColumnNames[3] = "City";
            mainScreenColumnNames[4] = "State";
            mainScreenColumnNames[5] = "Zip";
            mainScreenColumnNames[6] = "Account #";
            mainScreenColumnNames[7] = "Check #";
            mainScreenColumnNames[8] = "Amount";
            mainScreenColumnNames[9] = "Routing #";
            mainScreenColumnNames[10] = "Bank Name";
        }

        public static void InitEditScrnHashtable()
        {
            // add values to hashtable; digit represents column position and string represents header text
            editScreenColumnNames[0] = "First Name";
            editScreenColumnNames[1] = "Last Name";
            editScreenColumnNames[2] = "St. Address";
            editScreenColumnNames[3] = "City";
            editScreenColumnNames[4] = "State";
            editScreenColumnNames[5] = "Zip";
            editScreenColumnNames[6] = "Account #";
            editScreenColumnNames[7] = "Routing #";
            editScreenColumnNames[8] = "Check #";
            editScreenColumnNames[9] = "Check Date";
            editScreenColumnNames[10] = "Amount";
            editScreenColumnNames[11] = "Letter Sent";
        }

        public static void InitEditUserFormHashtable()
        {
            editUsersColumnNames[0] = "First Name";
            editUsersColumnNames[1] = "Last Name";
            editUsersColumnNames[2] = "Username";
            editUsersColumnNames[3] = "Password";
            editUsersColumnNames[4] = "Access Level";
        }

        public static void InitPrintLettersFormHashtable()
        {
            printLettersColumnNames[0] = "First Name";
            printLettersColumnNames[1] = "Last Name";
            printLettersColumnNames[2] = "Check Amount";
            printLettersColumnNames[3] = "Letter # Sent";
            printLettersColumnNames[4] = "Letter Received?";
        }

        public static string GetConnectionString()
        {
            string[] dbFileString = System.IO.File.ReadAllLines("Database.txt");
            if (dbFileString.Length < 2)
                return "";
            return dbFileString[1];
        }

        public static void Log(string str)
        {
            using (StreamWriter writer = new StreamWriter(Directory.GetCurrentDirectory() + "/log.txt", true))
            {
                writer.WriteLine(DateTime.Now.ToString() + ": " + str);
            }
        }
    }
}
